<?php

use swap\visitor;

class admin_header_helper extends \swap\helper {
	
	public static function run() {
		
		$controller_name = visitor::get_controller_name(); 
		
		$header_nav = array(
			array('title' => '首页', 'url' => 'admin-index/welcome', 'show_navon' => self::show_navon($controller_name, 'index')),
			array('title' => '全局', 'url' => 'admin-setting/basic', 'show_navon' => self::show_navon($controller_name, 'setting')),
			array('title' => '界面', 'url' => 'admin-nav/index', 'show_navon' => self::show_navon($controller_name, 'nav')),
			array('title' => '内容', 'url' => 'admin-moderate/index', 'show_navon' => self::show_navon($controller_name, 'moderate')),
		);
		
		self::set('header_nav', $header_nav);
		
		self::render();
		
	}
	
	public static function show_navon($controller_name, $needle) {
		$show = false;
		
		if ($controller_name === $needle) {
			$show = true;
		}
		
		return $show;
	}
	
}